/**
 * @param {String} title 弹窗标题
 * @param {String} [content=""] 弹窗内容
 * @return {Promise} 允许resolve，拒绝reject
 * */
export const showModal = function(title,content='') {
	return new Promise((resolve, reject) => {
		uni.showModal({
			title,
			content,
			success: res => {
				if (res.confirm) {
					resolve();
				} else {
					reject();
				}
			},
			fail: err => {
				reject();
			}
		})
	})
}

/**
 * @param {String} title 提示标题
 * */
export const toast = function(title) {
	uni.showToast({
		title,
		icon: 'none'
	})
}

/**
 * @param {String} [title='loading'] loading文字
 * */
export const showLoading = function(title = 'Loading') {
	uni.showLoading({
		title,
		mask: true
	})
}
export const hideLoading = function() {
	uni.hideLoading();
}